Skip to content

Accept piped data#3

Open
rothgar wants to merge 1 commit intoAATHITH:masterfrom
rothgar:master
Open

Accept piped data#3
rothgar wants to merge 1 commit intoAATHITH:masterfrom
rothgar:master

Conversation

@rothgar
Copy link

@rothgar rothgar commented Jun 7, 2021

Here is how I would want to use kubesort. Being able to pipe data into it in addition to using it as a command wrapper could be very useful.

Using bash and sort has some limitations but I think it mostly just works as expected (I didn't test every field)

You can run it without args and it'll default to AGE column

kubectl get po| ./kubesort
NAME                       READY   STATUS    RESTARTS   AGE
nginx2                     1/1     Running   1          29m
nginx                      1/1     Running   2          21h
postgres-0                 1/1     Running   0          4d4h
counter-7b58954fbf-zszkb   1/1     Running   0          4d4h

or run it with a column to sort.

kubectl get po| ./kubesort restarts
NAME                       READY   STATUS    RESTARTS   AGE
counter-7b58954fbf-zszkb   1/1     Running   0          4d4h
postgres-0                 1/1     Running   0          4d4h
nginx2                     1/1     Running   1          29m
nginx                      1/1     Running   2          21h

When you pipe data to it it doesn't limit what fields can be sorted but it does require you to use a header row because that's where it bases the sort argument from.

It might be good to handle tests in case the data is malformed or if kubectl spits out help text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant